package com.kun.framework.queue.core;

import com.kun.framework.core.exception.Assert;
import com.kun.framework.queue.consumer.KunConsumer;
import com.kun.framework.queue.core.enums.QueueKeyEnum;

/**
 * 默认抽象消费者类
 *
 * @author gzc
 * @since 2024/8/24
 **/
public abstract class DefaultAbstractConsumer<V> implements KunConsumer<V> {
    protected QueueKeyEnum queueKeyEnum;

    public DefaultAbstractConsumer() {
        this.queueKeyEnum = QueueKeyEnum.DEFAULT;
    }

    @Override
    public void bindQueue(QueueKeyEnum queueKeyEnum) {
        Assert.notNull(queueKeyEnum, "绑定的队列为空");
        this.queueKeyEnum = queueKeyEnum;
    }

    @Override
    public QueueKeyEnum getBindQueueKeyEnum() {
        return this.queueKeyEnum;
    }

}
